﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;
using BCNPCObject.DB;
using DbLinq;
using DbLinq.Oracle;
using CMISLibrary.Entities;
using CMISLibrary;

namespace BCNPCObject
{
    public class cls_NGC_Bieu01_Controller
    {
         #region   Atributes

        private DataSet CMIS_Header = new CMISOutputParameter();
        private DataSet ds = new DataSet();
        private DataTable dt = new DataTable();
        private PC1_NGE_BIEU01 info;

        #endregion

        #region   Constructor

        public cls_NGC_Bieu01_Controller()
        {
            info = new PC1_NGE_BIEU01();
        }
        public cls_NGC_Bieu01_Controller(PC1_NGE_BIEU01 Info)
        {
            this.info = Info;
        }

        #endregion

        #region   Properties

        public PC1_NGE_BIEU01 pInfor
        {
            get { return info; }
            set { info = value; }
        }

        #endregion

        #region  BCKD NGC

        public IEnumerable<PC1_NGE_BIEU01> select_Data_PC1_NGE_BIEU01(System.String pr_MA_DVIQLY, System.Int16 intThang, System.Int16 intNam)
        {
            var a = from p in CMIS2.DB.PC1_NGE_BIEU01
                    where p.MA_DVIQLY.Contains(pr_MA_DVIQLY)
                    && p.NAM == intNam
                    && p.THANG == intThang
                    orderby p.MA_DVIQLY ascending
                    select p;
            if (a != null && a.Count() > 0)
            {
                return a;
            }
            else
                return null;
        }
        public IEnumerable<PC1_NGE_BIEU01> select_PC1_NGE_BIEU01(string strMadviqly, Int16 strThang, Int16 strNam)
        {
            try
            {
                CMIS2.ResetDB();
                var q = from p in CMIS2.DB.PC1_NGE_BIEU01
                        orderby p.MA_DVIQLY ascending
                        where (p.MA_DVIQLY.Contains(strMadviqly)) && (p.THANG == strThang) && (p.NAM == strNam)
                        select p;
                return q;
            }
            catch (Exception ex)
            {
                CMIS2.ResetDB();
                return null;
            }
        }

        #endregion
    }
}
